package com.kevin.service.config.mp;

import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.kevin.common.json.JsonUtil;
import com.kevin.service.entity.sub.QuestionAnswer;
import com.fasterxml.jackson.core.type.TypeReference;

import java.util.List;

public class SelfTypeHandler {

    public static class QuestionAnswerTypeHandler extends AbstractJsonTypeHandler<List<QuestionAnswer>> {
        TypeReference<List<QuestionAnswer>> typeReference = new TypeReference<List<QuestionAnswer>>() {
        };

        @Override
        protected List<QuestionAnswer> parse(String json) {
            return JsonUtil.parse(json, typeReference);
        }

        @Override
        protected String toJson(List<QuestionAnswer> obj) {
            return JsonUtil.toJson(obj);
        }
    }

}
